import Cookies from "js-cookie";

//注意,这里的TokenKey要与后端的一致,之后要修改
const TokenKey = "hm--vuex-token";

export function getToken() {
  const str = Cookies.get(TokenKey);
  if(str){
    return JSON.parse(str).user.token
  }
  return null
}

export function setToken(token) {
  return Cookies.set(TokenKey, token);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}
